home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / prog_c / cuj0696.zip / DWYER.ZIP / SERIAL.TST / SERLCOD.TXT < prev    next >
Text File  |  1996-02-13  |  2KB  |  44 lines

  1. Algorithm S (Serial Test)
  2.  
  3. This algorithm calculates Kolmogorov-Smirnov statistics and
  4. probabilities for sets of successive independent random pairs.
  5. The upper range (R) of the data set is specified by the user.
  6. First, 100 chi-square probabilities are calculated and stored.
  7. These probabilities are used to calculate Kolmogorov-Smirnov
  8. statistics and probabilities which are printed.
  9.  
  10. Inputs:
  11.  
  12. C = Number of Categories           (= S^2)
  13. P = Number of Pairs of Variates
  14. S = Number of Entries in Data Set
  15. U() = Uniform Random Number Generator Function Under Test
  16.  
  17. S1. [Initialize.]  Set k <- 0, m <- 0, F <- C - 1.
  18.  
  19. S2. [Generate Data for KS test.]  Execute Steps S3 to S7 100 times,
  20.     then go on to S8.
  21.  
  22. S3. [Calculate next chi-square statistic.]  Set SoS <- 0, t <- 0,
  23.     m <- 0, and set Occurs[j] <- 0, 1 <= j <= C. (We will execute
  24.     step S4 P times. Steps S5 and S6 complete the calculation.)
  25.  
  26. S4. [Tally Next Observation.]  Set x <- U() mod S, y <- U() mod S,
  27.     and v = x * S + y.  Set Occurs[v] <- Occurs[v] + 1.  Increase t.
  28.     If t < P, repeat this step.
  29.  
  30. S5. [Calculate sum of squares.]  Set SoS <= SoS + Occurs[m]^2, and
  31.     m <- m + 1.  If m < C, repeat this step.
  32.  
  33. S6. [Finish chi-square statistic.]  Set XSQ <- (C/P) * SoS - P.
  34.  
  35. S7. [Calculate p-value.]  Execute function chdtr() to get p-value.
  36.     Set k <- k + 1. Then, set ProbXSQ[k] <- chdtr(F, XSQ). If k < 100,
  37.     return to step S3.
  38.  
  39. S8. [Calculate K-S data.]  Execute function KSCalc() to get K-S
  40.     statistics and probabilities.  There will be four quantities
  41.     produced - Kn+, Pn+, Kn-, Pn-.
  42.  
  43. S9. [Print Results.]  Print Kn+, Pn+, Kn-, Pn-.
  44.